package com.xj.qq.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.xj.qq.R;

/**
 * Created by XJ on 2015/12/26
 */
public class MenuListViewAdapter extends BaseAdapter {
    private int[] imgStrs;
    private String[] textStrs;
    private Context context;

    public MenuListViewAdapter(int[] imgStrs, String[] textStrs, Context context) {
        this.imgStrs = imgStrs;
        this.textStrs = textStrs;
        this.context = context;
    }

    @Override
    public int getCount() {
        return textStrs.length;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.sliding_menu_item,parent,false);
        ImageView iv = (ImageView) view.findViewById(R.id.ls_img);
        TextView tv = (TextView) view.findViewById(R.id.ls_text);
        iv.setImageResource(imgStrs[position]);
        tv.setText(textStrs[position]);
        return view;
    }
}
